Skip to main content

median

Type​

function

Summary​

Returns the median (middle number) of a list of numbers.

Syntax​

median(<numbersList>)

Description​

Use the median function to find the value that best represents a group of values.

If the number of items in the numbersList is odd, the median function returns the middle value of the list when it is sorted in numeric order. If the number of items is even, the median function takes the two middle values and averages them to produce the median.

If the list consists of fewer than three numbers, or if the numbers are evenly distributed, the median is equal to the average.

If a math operation on finite inputs produces a non-finite output, an execution error is thrown. See math operations for more information.

Parameters​

NameTypeDescription

numbersList

A comma-separated list of numbers, or an expression that evaluates to such a list, or an array containing only numbers.

Examples​

median(6,22,8) -- returns 8
put median(incomeLevels) into field "2001 Median Income"

Value​

NameTypeDescription

return

The median function returns a number.

control structure: function

function: average, standardDeviation, value

glossary: return, value, math operation

Compatibility and Support​

Introduced

LiveCode 1.1

OS

mac

windows

linux

ios

android

Platforms

desktop

server

mobile

Thank you for your feedback!

Was this page helpful?